/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package e.z.blog.back.action;

import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import z.h.w.jar.kit.IO;

/**
 *
 * @author EnzoZhong
 */
public abstract class AbstractAction {

        public abstract Map<String , Object> page ( HttpServletRequest req );

        public Map<String , Object> createMap ( HttpServletRequest req , String path ) {
                Map<String , Object> re = new HashMap();
                re.put( "type" , path );
                re.put( "id" , path + "Id" );
                /*
                 * back2FirstFolder这个方法是为了计算要退格多少个例如../../这样就是退格
                 * 2个，这个做的好处是，可以使不管以后这个链接的url怎么换，前面所需要退格
                 * 的数量都是自动算出来的，这样的话，就达到所引用的js，css都能够正常加载
                 */
                re.put( "path" , IO.back2Floder( req.getServletPath() ) );
                return re;
        }
}
